package cn.tedu.mall.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.util.Date;

@TableName(value = "tb_item")
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true) //开启了连点操作
public class Item {
    //Item item=new Item（）
    @TableId(type = IdType.AUTO)
    private Long id;
    private String title;
    private String sellPoint;
    private Long price;
    private Integer num;//商品数量
    private String barcode;//商品条形码
    private String image;//图片的路径
    private Long cid;//商品分类id 外键
    private Integer status;//商品的状态：上架1  下架2
    private Date created;
    private Date updated;
    //为了满足页面的调用需求，需要添加get方法
    public String[] getImages(){
        return image.split(",");
    }
}
